

%% Preprocess particular anim
function [] = preprocessAnim( dir, fileName, refFileName, toId  )

dir = strcat('..\..\res\', dir);
addpath(genpath('../util'));
addpath(genpath('../io'));
addpath(genpath('../strain'));
addpath(genpath('../export'));
addpath(genpath('../obj-tools'));
addpath(genpath('..'));

%refFileName = getFileNameForId(fileName, fromId);
referencePath = strcat([dir '\'], refFileName);

[vertices, topology] = read_wobj(referencePath);
[nV, x] = size(vertices);
%save( strcat('', strcat( fileName, '.mat') ), 'topology' );
frames = zeros(toId + 1, nV * 3);
frames(1, :) = getMyFrame(vertices);

for targetId = 2:toId
    LOG( ['Processing frame ' int2str(targetId)] );
    targetFileName = getFileNameForId(fileName, targetId);
    targetFileName = strcat(strcat(dir, '\'), targetFileName);
    [vertices, topology] = read_wobj(targetFileName);
    frames(targetId, :) = getMyFrame(vertices);
end%for

save( strcat('', strcat(fileName, '.mat')), 'topology', 'frames' );

end % function preprocessAnim 

